package ch.dreamweb.readpractice.client.lesetraining.widget;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;

public class MessageDialog extends DialogBox {

	public MessageDialog() {

		// TODO MKE make nicer and test it
		// still used? yes, to show exceptions

		// Enable animation.
		setAnimationEnabled(true);

		// Enable glass background.
		setGlassEnabled(true);

		// DialogBox is a SimplePanel, so you have to set its widget property to
		// whatever you want its contents to be.
		Button ok = new Button("OK");
		ok.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				MessageDialog.this.hide();
			}
		});
		setWidget(ok);
		ok.setFocus(true);
	}

	public MessageDialog(String text) {
		this();
		// Set the dialog box's caption.
		setText(text);
	}

}
